import { useDispatch, useSelector } from 'react-redux'
import { asyncUpdMsg } from '@/store/modules/count'

export default function Count2() {
  const dispatch = useDispatch()
  const state = useSelector((state) => {
    return state.count
  })
  return (
    <div
      style={{
        border: '2px solid #aaabbb',
        padding: '20px',
        marginTop: '10px',
      }}
    >
      <h1>Count2组件</h1>
      <div>{state.msg}</div>

      <button
        onClick={() => {
          dispatch(asyncUpdMsg())
        }}
      >
        点击异步修改msg的值
      </button>
    </div>
  )
}
